package networkInterface;

import java.io.File;
import java.net.InetAddress;
import observerNotification.ErrorObserverNotification;


/**
 * ToNetWork interface
 * 
 * <p>
 * <ul>
 * <li>Project: 	ChatSystemG3</li>
 * </ul>
 * </p>
 * 
 * @author COMBES Nicolas - LECHANTRE Arnaud
 */
public interface ToNetwork {

	
	/**
	 * Sends an hello message to the remote user
	 * @param localUsername self-explanatory
	 * @param remoteAddresss address of remote user
	 */
	public void sendHello(String localUsername,InetAddress remoteAddress);
	
	
	/**
	 * Sends an Goodbye message to the remote users
	 * @param localUsername self-explanatory
	 */
	public void sendGoodbye(String localUsername);
	
	
	/**
	 * Sends a text message to the remote user
	 * @param localUsername self-explanatory
	 * @param messageToSend text to be sent
	 * @param remoteAddress remote user ip address
	 */
	public void sendMessage(String localUsername, String messageToSend, InetAddress remoteAddress);
	
	
	/**
	 * sendFile
	 * @param localUsername self-explanatory
	 * @param file file to be sent
	 * @param remoteAddress remote user ip address
	 */
	public void sendFile(int convId, String localUsername, File file, InetAddress remoteAddress);
	
	
	/**
	 * sendFileRequest
	 * @param localUsername self-explanatory
	 * @param file the file to send
	 * @param remoteAddress remote user ip address
	 */
	public void sendFileRequest(String localUsername, File file, InetAddress remoteAddress);
	
	
	/**
	 * Sends an answer to remote user - if positive, prepare receiving
	 * @param convId identifier of conversation corresponding to the received file request
	 * @param localUsername self-explanatory
	 * @param remoteAddress remote user ip address
	 * @param fileName name of the file to receive
	 * @param downloadDirectory path to save file
	 */
	public void sendFileAnswer(int convId, String localUsername, InetAddress remoteAddress,  String fileName, File downloadDirectory);

	
	/**
	 * Removes sender from the fileSenderList & notify the controller the file has been sent
	 * @param chatNIFileSender file sender
	 * @param convId identifier of the conversation in which the file has been sent
	 */
	public void notifyFileTransferFinished(ChatNIFileSender chatNIFileSender,int convId);

	
	/**
	 * Removes sender from the fileSenderList & notify the controller the file transfert has been aborted
	 * @param chatNIFileSender sender that had to send the file
	 * @param convId identifier of the conversation in which the file had to be sent
	 */
	public void notifyFileEmissionAbort(ChatNIFileSender chatNIFileSender, int convId);
	
	
	/**
	 * relayError
	 * @param error error to be displayed to user
	 */
	public void relayError(ErrorObserverNotification error);

}
